package com.aaa.doctor.controller.api;

import com.aaa.doctor.service.CareHistoryService;
import com.aaa.entity.CareHistory;
import com.aaa.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author MuChengGuo
 * @date 2023/3/25 8:54
 * Description: TODO
 **/
@Api(tags = "前端 - 患者病例信息")
@RestController
@RequestMapping("/doctor/api/careHistory")
public class CareHistoryApiController {

    @Autowired
    private CareHistoryService careHistoryService;

    @GetMapping("getListByPatientId/{patientId}")
    @ApiOperation(value = "通过患者ID(patientId)查询患者病例信息 - List<CareHistory>")
    public Result<List<CareHistory>> getListByPatientId(
            @ApiParam(value = "当前患者ID", required = true) @PathVariable String patientId
    ) {
        return careHistoryService.getListByPatientId(patientId);
    }

    @PostMapping("saveCareHistory")
    @ApiOperation(value = "保存病历本")
    public Result<String> saveCareHistory(@RequestBody CareHistory careHistory) {
        return careHistoryService.saveCareHistory(careHistory);
    }

}
